home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / 1.098 / raid / devPrint.c < prev    next >
C/C++ Source or Header  |  1990-10-12  |  6KB  |  210 lines

  1. /* 
  2.  * devPrint.c --
  3.  *
  4.  *    Routines for printing out various RAID related data structures.
  5.  *
  6.  * Copyright 1989 Regents of the University of California
  7.  * All rights reserved.
  8.  * Permission to use, copy, modify, and distribute this
  9.  * software and its documentation for any purpose and without
  10.  * fee is hereby granted, provided that the above copyright
  11.  * notice appear in all copies.  The University of California
  12.  * makes no representations about the suitability of this
  13.  * software for any purpose.  It is provided "as is" without
  14.  * express or implied warranty.
  15.  */
  16.  
  17. #ifndef lint
  18. static char rcsid[] = "$Header: /sprite/src/kernel/raid/RCS/devPrint.c,v 1.6 90/10/12 14:00:51 eklee Exp $ SPRITE (Berkeley)";
  19. #endif /* not lint */
  20.  
  21. #include "sync.h"
  22. #include <sprite.h>
  23. #include <stdio.h>
  24. #include "fs.h"
  25. #include "devBlockDevice.h"
  26. #include "devRaid.h"
  27. #include "schedule.h"
  28.  
  29.  
  30. /*
  31.  *----------------------------------------------------------------------
  32.  *
  33.  * PrintHandle --
  34.  *
  35.  *    Print DevBlockDeviceHandle.
  36.  *
  37.  * Results:
  38.  *    None.
  39.  *
  40.  * Side effects:
  41.  *    Prints to stdout.
  42.  *
  43.  *----------------------------------------------------------------------
  44.  */
  45.  
  46. void
  47. PrintHandle(handlePtr)
  48.     DevBlockDeviceHandle  *handlePtr; /* Handle pointer of device. */
  49. {
  50. /*
  51.     printf("DevBlockDeviceHandle %x:\n", handlePtr);
  52.     printf("    blockIOProc  : %x\n", handlePtr->blockIOProc);
  53.     printf("    IOControlProc: %x\n", handlePtr->IOControlProc);
  54.     printf("    releaseProc  : %x\n", handlePtr->releaseProc);
  55.     printf("    minTransferUnit: %x\n", handlePtr->minTransferUnit);
  56.     printf("    maxTransferSize: %x\n", handlePtr->maxTransferSize);
  57.     printf("    clientData: %x\n", handlePtr->clientData);
  58. */
  59. }
  60.  
  61.  
  62. /*
  63.  *----------------------------------------------------------------------
  64.  *
  65.  * PrintDevice --
  66.  *
  67.  *    Print Fs_Device.
  68.  *
  69.  * Results:
  70.  *    None.
  71.  *
  72.  * Side effects:
  73.  *    Prints to stdout.
  74.  *
  75.  *----------------------------------------------------------------------
  76.  */
  77.  
  78. void
  79. PrintDevice(devicePtr)
  80.     Fs_Device  *devicePtr; /* Handle pointer of device. */
  81. {
  82.     printf("Device %u %02u\n", devicePtr->type, devicePtr->unit);
  83. /*
  84.     printf("Device %x:\n", devicePtr);
  85.     printf("    type: %d  unit: %02u\n", devicePtr->type, devicePtr->unit);
  86. */
  87. }
  88.  
  89.  
  90. /*
  91.  *----------------------------------------------------------------------
  92.  *
  93.  * PrintRequest --
  94.  *
  95.  *    Print DevBlockDeviceRequest.
  96.  *
  97.  * Results:
  98.  *    None.
  99.  *
  100.  * Side effects:
  101.  *    Prints to stdout.
  102.  *
  103.  *----------------------------------------------------------------------
  104.  */
  105.  
  106. void
  107. PrintRequest(requestPtr)
  108.     DevBlockDeviceRequest *requestPtr; /* IO Request to be performed. */
  109. {
  110.     char *opStr;
  111.  
  112.     opStr = (requestPtr->operation == FS_READ ? "READ": "WRITE");
  113.  
  114.     printf("Block Request %s %x %x:\n", opStr, requestPtr->startAddress,
  115.         requestPtr->bufferLen);
  116. /*
  117.     printf("Block Request %x:\n", requestPtr);
  118.     printf("    operation: %s\n", (requestPtr->operation == FS_READ ?
  119.                                 "READ": "WRITE") );
  120.     printf("    startAddrHigh: %x\n", requestPtr->startAddrHigh);
  121.     printf("    startAddress : %x\n", requestPtr->startAddress);
  122.     printf("    bufferLen    : %x\n", requestPtr->bufferLen);
  123.     printf("    buffer: %x %40s\n", requestPtr->buffer, requestPtr->buffer);
  124.     printf("    doneProc  : %x\n", requestPtr->doneProc);
  125.     printf("    clientData: %x\n", requestPtr->clientData);
  126. */
  127. }
  128.  
  129.  
  130. /*
  131.  *----------------------------------------------------------------------
  132.  *
  133.  * PrintRaid --
  134.  *
  135.  *    Print Raid.
  136.  *
  137.  * Results:
  138.  *    None.
  139.  *
  140.  * Side effects:
  141.  *    Prints to stdout.
  142.  *
  143.  *----------------------------------------------------------------------
  144.  */
  145.  
  146. void
  147. PrintRaid(raidPtr)
  148.     Raid *raidPtr;
  149. {
  150.     int         col, row;
  151.     RaidDisk    *diskPtr;
  152.  
  153.     printf("RAID=================================================\n");
  154.     printf("    state %d\n", raidPtr->state);
  155.     PrintDevice(raidPtr->devicePtr);
  156.     printf("    numRow %d\n", raidPtr->numRow);
  157.     printf("    numCol %d\n", raidPtr->numCol);
  158.     printf("    numSector %u\n", raidPtr->numSector);
  159.     printf("    dataSectorsPerStripe %u\n",raidPtr->dataSectorsPerStripe);
  160.     printf("    sectorsPerDisk %u\n",raidPtr->sectorsPerDisk);
  161.     printf("    bytesPerStripeUnit %u\n",raidPtr->bytesPerStripeUnit);
  162.     printf("    dataBytesPerStripe %u\n",raidPtr->dataBytesPerStripe);
  163.     printf("    numDataCol %d\n", raidPtr->numDataCol);
  164.     printf("    logBytesPerSector %d\n", raidPtr->logBytesPerSector);
  165.     printf("    sectorsPerStripeUnit %d\n", raidPtr->sectorsPerStripeUnit);
  166.     printf("    rowsPerGroup %d\n", raidPtr->rowsPerGroup);
  167.     printf("    stripeUnitsPerDisk %d\n", raidPtr->stripeUnitsPerDisk);
  168.     printf("    groupsPerArray %d\n", raidPtr->groupsPerArray);
  169.     printf("    parityConfig %c\n", raidPtr->parityConfig);
  170.     if (raidPtr->disk != NULL) {
  171.     for ( row = 0; row < raidPtr->numRow; row++ ) {
  172.         for ( col = 0; col < raidPtr->numCol; col++ ) {
  173.         diskPtr = raidPtr->disk[col][row];
  174.         if (diskPtr != (RaidDisk *) NIL) {
  175.             printf("Disk: %d %d %d  state: %d  numValidSector: %d\n",
  176.                 row, col, diskPtr->version,
  177.                 diskPtr->state, diskPtr->numValidSector);
  178.             PrintDevice(&diskPtr->device);
  179.         }
  180.         }
  181.     }
  182.     }
  183.     printf("LogDisk: offset=%d\n", raidPtr->logDevOffset);
  184.     PrintDevice(&raidPtr->logDev);
  185.     printf("=====================================================\n");
  186. }
  187.  
  188.  
  189. /*
  190.  *----------------------------------------------------------------------
  191.  *
  192.  * PrintTime --
  193.  *
  194.  *    Print current time.
  195.  *
  196.  * Results:
  197.  *    None.
  198.  *
  199.  * Side effects:
  200.  *    Prints to stdout.
  201.  *
  202.  *----------------------------------------------------------------------
  203.  */
  204.  
  205. void
  206. PrintTime()
  207. {
  208.     printf("TIME: %lg\n", LocalTime());
  209. }
  210.